/**
 * Created with IntelliJ IEDA.
 * Description:
 * User:86186
 * Date:2022-09-11
 * Time:15:36
 */

/**
 * 力扣328:奇偶链表
 */

public class oddEvenList {
    public ListNode oddEvenList(ListNode head) {
        if(head == null){
            return null;
        }
        ListNode enenNumber = head.next;
        ListNode oddNumber = head;
        ListNode even = enenNumber;
        while(even != null && even.next != null){
            oddNumber.next = even.next;
            oddNumber = oddNumber.next;
            even.next = oddNumber.next;
            even = even.next;
        }
        oddNumber.next = enenNumber;
        return head;
    }
}
